package com.wgworkshop.games.raindrop;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;

/**
 * Created by wlc on 2017/5/27.
 */
public class MainMenuScreen extends ScreenAdapter {
    private final Raindrop game;
    private OrthographicCamera camera;

    public MainMenuScreen(final Raindrop game) {
        this.game = game;

        camera = new OrthographicCamera();
        camera.setToOrtho(false, game.WIDTH, game.HEIGHT);
    }

    @Override
    public void render(float delta) {
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        camera.update();

        game.batch.setProjectionMatrix(camera.combined);

        game.batch.begin();
        game.font.draw(game.batch, "HIGH-SCORE:" + game.highScore, 0, game.HEIGHT);
        game.font.draw(game.batch, "Welcome to Raindrop.", 100, 150);
        game.font.draw(game.batch, "Touch anywhere to start.", 100, 100);
        game.batch.end();

        if (Gdx.input.isTouched()) {
            game.setScreen(new GameScreen(game));
            dispose();
        }
    }
}
